package com.bodu.system.controller;

import com.bodu.core.entity.result.Result;
import com.bodu.global.annon.TraceLog;
import com.wf.captcha.utils.CaptchaUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 验证码
 *
 * @author Administrator
 */
@CrossOrigin
@RestController
@RequestMapping("/captcha")
public class CaptchaController {

    @TraceLog()
    @ApiOperation(value = "获取验证码")
    @RequestMapping("v1")
    public void captcha(javax.servlet.http.HttpServletRequest request, HttpServletResponse response) throws Exception {
        CaptchaUtil.out(request, response);
    }

    @TraceLog()
    @ResponseBody
    @RequestMapping("/validError")
    public Result validError(HttpServletRequest request , HttpServletResponse response) {
        return Result.fail("验证码错误");
    }

}
